package com.fun.demo.fun;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;

public class ProcTest {
    public static void main(String[] args) throws SQLException, ClassNotFoundException {
        String driver= "oracle.jdbc.OracleDriver";
        String jdbcUrl = "jdbc:oracle:thin:@//192.168.0.93:1521/orcl";
        String user = "hrsys";
        String pwd = "hrsys";
        String procName = "SkySecUserAuth";
        Connection conn = null;
        Class.forName(driver);
        conn = DriverManager.getConnection(jdbcUrl, user, pwd);
        System.out.println(String.format("Connect %s Success, User: %s, SP: %s", jdbcUrl, user, procName));
        ResultSet resultSet = conn.getMetaData().getProcedureColumns(conn.getCatalog(), user.toUpperCase(), procName.toUpperCase(), null);

        while (resultSet.next()) {
            Object name = resultSet.getObject("COLUMN_NAME");
            Object type = resultSet.getObject("TYPE_NAME");
            System.out.println(name + "    " + type);
        }
    }
}
